# F
# system (100) of nlin.SI/0601046

coordinates([x,t],[z],11):

equation(z_tt=-1/54*z_10x+z_5x_t+5/6*z_8x*z_xx+5/3*z_7x*z_xxx+5/2*z_6x*z_4x+25/12*z_5x^2-5*z_4x*z_xt-15/2*z_xxx*z_xxt-10*z_xx*z_xxxt-45/4*z_6x*z_xx^2-75/2*z_xx*z_xxx*z_5x-75/4*z_4x^2*z_xx-75/4*z_xxx^2*z_4x+45/2*z_xx^2*z_xt+225/4*z_4x*z_xx^3+675/8*z_xxx^2*z_xx^2-405/16*z_xx^5);

with(linalg):
A := matrix(3,3, [a11, a12, a13, a21, a22, a23, a31, a32, -a11-a22]);
B := matrix(3,3, [b11, b12, b13, b21, b22, b23, b31, b32, -b11-b22]); 
R := matrix(3,3, [0, 0, 0, 1, 0, 0, 0, 0, 0]);

S := zero_curvature(x = A, t = B, 1 = R);

dependence(
  a11(z, z_t,  seq(jet(z,x^i),i=1..5)), 
  a12(z, z_t,  seq(jet(z,x^i),i=1..5)),
  a13(z, z_t,  seq(jet(z,x^i),i=1..5)),
  a21(z, z_t,  seq(jet(z,x^i),i=1..5)),
  a22(z, z_t,  seq(jet(z,x^i),i=1..5)),
  a23(z, z_t,  seq(jet(z,x^i),i=1..5)),
  a31(z, z_t,  seq(jet(z,x^i),i=1..5)),
  a32(z, z_t,  seq(jet(z,x^i),i=1..5)), 
  
  b11(z, z_t, seq(jet(z,x^i),i=1..7), seq(jet(z,t*x^i),i=1..6)),
  b12(z, z_t, seq(jet(z,x^i),i=1..7), seq(jet(z,t*x^i),i=1..6)),
  b13(z, z_t, seq(jet(z,x^i),i=1..7), seq(jet(z,t*x^i),i=1..6)),
  b21(z, z_t, seq(jet(z,x^i),i=1..7), seq(jet(z,t*x^i),i=1..6)), 
  b22(z, z_t, seq(jet(z,x^i),i=1..7), seq(jet(z,t*x^i),i=1..6)),
  b23(z, z_t, seq(jet(z,x^i),i=1..7), seq(jet(z,t*x^i),i=1..6)),
  b31(z, z_t, seq(jet(z,x^i),i=1..7), seq(jet(z,t*x^i),i=1..6)),
  b32(z, z_t, seq(jet(z,x^i),i=1..7), seq(jet(z,t*x^i),i=1..6)));

a11 := 0;
a12 := 0;
a13 := 1;
a22 := 0;
a23 := 0;


unknowns(
a21, a31, a32, 
b11, b12, b13, b21, b22, b23, b31, b32, 
F);


interface(labelling=false);
Varordering(degree,reverse,function):


TestOfNonImportantness := proc()
  description "Returns NULL if current state is important." ;
  global A, R;
  local allvars, itemsOfAwithoutZero ;
  try
    A := map(simpl@evalTD, A);
    allvars := `union`(op(map((vars@eval), convert(A,set) union convert(B,set))));
    itemsOfAwithoutZero := map(eval, convert(A,set)) minus {0};
    if allvars subset {x,t} then
      print("TestOfNonImportantness failed, not enough variables: ", d);
      "TestOfNonImportantness failed: Not enough variables." 
    elif map(a -> vars( (simpl@normal@eval)(a/op(1, itemsOfAwithoutZero))), itemsOfAwithoutZero) = {{}} then
     print("TestOfNonImportantness failed, A is a multiple of constant matrix.", op(A));
     "TestOfNonImportantness failed: A is a multiple of constant matrix."
#    elif evalb(convert(map(eval@Diff,op(A),s),set) = {0}) then
#      print("TestOfNonImportantness failed, none or trivial parameter.");
#      "TestOfNonImportantness failed: None or trivial parameter."
    elif evalb(convert(map(normal@eval@evalTD,op(R)),set)={0}) then
      print("R=0");
      "TestOfNonImportantness failed: R is 0."
    elif ((A[1,2]=0 and A[1,3]=0) or (A[2,1]=0 and A[2,3]=0) or (A[3,1]=0 and A[3,2]=0) 
       or (A[2,1]=0 and A[3,1]=0) or (A[1,2]=0 and A[3,2]=0) or (A[1,3]=0 and A[2,3]=0)) then
       print("TestOfNonImportantness failed, A fall into the subalgebra: ", op(A));
      "TestOfNonImportantness failed: A fall into the subalgebra."
    elif nops(`nonzero/getzeros`(`nonzero/s`)) <> 0 then
      print("TestOfNonImportantness failed, declared nonzero became zero: ", `nonzero/s`);
      "TestOfNonImportantness failed: declared nonzero became zero."
#    elif evalb(simpl(eval(variation(F,u)))=0) then
#      print("TestOfNonImportantness failed, variation(F,u) is zero: ", 'F'=factor(F));
#      "TestOfNonImportantness failed, variation(F,u) is zero."  
    else
      # print("TestOfNonImportantness ok, ", d);
      NULL
    fi 
  catch:
    print("Error in TestOfNonImportantness:"); 
    print(StringTools[FormatMessage](lastexception[2..-1]));
  end try
end proc;